# vim: set ft=sh:
install() {
    [ -x /sbin/splashy ] || return 1

    THEMES_DIR="$(splashy_config --get-key /splashy/themes 2> /dev/null)"
    CURRENT_THEME="$(splashy_config --get-key /splashy/current_theme 2> /dev/null)"

    #add_binary "${BASEDIR}/sbin/splashy" "/sbin/splashy"
    add_file "${BASEDIR}/sbin/splashy" "/sbin/splashy"
    add_file "/sbin/splashy_chvt"
    add_file "/etc/splashy/config.xml"
    add_full_dir "${THEMES_DIR}/${CURRENT_THEME}"

    #shared libraries needed by splashy
    add_file "${BASEDIR}/usr/lib/libsplashycnf.so.1" "/usr/lib/libsplashycnf.so.1"
    add_file "${BASEDIR}/usr/lib/libsplashy.so.1" "/usr/lib/libsplashy.so.1"
    add_file "${BASEDIR}/usr/lib/libglib-2.0.so.0" "/usr/lib/libglib-2.0.so.0"
    add_file "${BASEDIR}/usr/lib/libdirectfb-1.2.so.0" "/usr/lib/libdirectfb-1.2.so.0"
    add_file "${BASEDIR}/usr/lib/libfusion-1.2.so.0" "/usr/lib/libfusion-1.2.so.0"
    add_file "${BASEDIR}/usr/lib/libdirect-1.2.so.0" "/usr/lib/libdirect-1.2.so.0"
    add_file "${BASEDIR}/usr/lib/libpng12.so.0" "/usr/lib/libpng12.so.0"
    add_file "${BASEDIR}/usr/lib/libjpeg.so.62" "/usr/lib/libjpeg.so.62"
    add_file "${BASEDIR}/usr/lib/libfreetype.so.6" "/usr/lib/libfreetype.so.6"
    add_file "${BASEDIR}/lib/libm.so.6" "/lib/libm.so.6"
    add_file "${BASEDIR}/lib/libpthread.so.0" "/lib/libpthread.so.0"
    add_file "${BASEDIR}/usr/lib/libz.so.1" "/usr/lib/libz.so.1"
    add_file "${BASEDIR}/lib/libdl.so.2" "/lib/libdl.so.2"
    add_file "${BASEDIR}/lib/libc.so.6" "/lib/libc.so.6"
    add_file "${BASEDIR}/lib/libpcre.so.0" "/lib/libpcre.so.0"
    add_file "${BASEDIR}/lib/libsysfs.so.2" "/lib/libsysfs.so.2"
    add_file "${BASEDIR}/usr/lib/directfb-1.2-0/wm/libdirectfbwm_default.so" "/usr/lib/directfb-1.2-0/wm/libdirectfbwm_default.so"
    add_file "${BASEDIR}/usr/lib/directfb-1.2-0/systems/libdirectfb_fbdev.so" "/usr/lib/directfb-1.2-0/systems/libdirectfb_fbdev.so"
    add_file "${BASEDIR}/usr/lib/directfb-1.2-0/inputdrivers/libdirectfb_keyboard.so" "/usr/lib/directfb-1.2-0/inputdrivers/libdirectfb_keyboard.so"
    add_file "${BASEDIR}/usr/lib/directfb-1.2-0/interfaces/IDirectFBFont/libidirectfbfont_ft2.so" "/usr/lib/directfb-1.2-0/interfaces/IDirectFBFont/libidirectfbfont_ft2.so"
    add_file "${BASEDIR}/usr/lib/directfb-1.2-0/interfaces/IDirectFBFont/libidirectfbfont_default.so" "/usr/lib/directfb-1.2-0/interfaces/IDirectFBFont/libidirectfbfont_default.so"
    add_file "${BASEDIR}/usr/lib/directfb-1.2-0/interfaces/IDirectFBImageProvider/libidirectfbimageprovider_png.so" "/usr/lib/directfb-1.2-0/interfaces/IDirectFBImageProvider/libidirectfbimageprovider_png.so"
    add_file "${BASEDIR}/usr/lib/directfb-1.2-0/interfaces/IDirectFBImageProvider/libidirectfbimageprovider_jpeg.so" "/usr/lib/directfb-1.2-0/interfaces/IDirectFBImageProvider/libidirectfbimageprovider_jpeg.so"

    if [ $(arch) = "x86_64" ]; then
        add_file "${BASEDIR}/lib/ld-linux-x86-64.so.2" "/lib/ld-linux-x86-64.so.2"
    else
        add_file "${BASEDIR}/lib/ld-linux.so.2" "/lib/ld-linux.so.2"
    fi

    SCRIPT="splashy"
}

help() {
echo "This hook includes Splashy in the initramfs image."
}

#EOF
